package com.zybzzz.workapp.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Project Name：workapp
 * Class Name：DateChangeUtils
 * description：有关日期转换的工具类
 * Date：2020-10-24 12:28
 * author：zhangyibo
 */
public class DateChangeUtils {
    private static Calendar calendar=Calendar.getInstance();

    public static String date2String(Date date){
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
        return simpleDateFormat.format(date);
    }


    public static Date nextDate(Date date){
        calendar.setTime(date);
        calendar.add(Calendar.DAY_OF_MONTH,1);
        return calendar.getTime();
    }

    public static Date prevDate(Date date){
        calendar.setTime(date);
        calendar.add(Calendar.DAY_OF_MONTH,-1);
        return calendar.getTime();
    }
}
